* ==============================================================================
*
* Date:	Fall 2024
* Paper: Environmental disasters and ecomodernist beliefs: Insights from a quasi‐natural experiment
*
* This is the master do-file
*
* Datasets used: 
*
*(1) News and Search terms.dta
*(2) ESS_R5_Israel.dta
*(3) ESS_R5_Israel_FE.dta
*(4) Experiment_US.dta
*(5) Experiment_IL.dta
* ==============================================================================



*****************************************************************************
*Open data to replicate findings on search terms and news articles
*****************************************************************************

clear
*open the data file (1) "News and Search terms.dta"

*****************************************************************************
*Figure 1 replication
*****************************************************************************

twoway (line fukushima_news edate, lcolor(green)), xline(18697, lwidth(medthick) lpattern(dash) lcolor(red)) scheme(s1mono) legend( label (1 "News trend 'Fukushima'")) xtitle("Dates") ytitle("No. news articles")

*****************************************************************************
*Figure 2 replication
*****************************************************************************

twoway (line hebrew_tsunami edate, lcolor(blue)), xline(18697, lwidth(medthick) lpattern(dash) lcolor(red)) scheme(s1mono) legend( label (1 "Search trends")) xtitle("") ytitle("")

*****************************************************************************
*Open data to replicate ESS findings
*****************************************************************************

clear
*open the data file (2) "ESS_R5_Israel.dta"

*****************************************************************************
*Figure 3 replication
*****************************************************************************

histogram edate, freq lcolor(gs12) xline(18697, lwidth(medthick) lpattern(dash) lcolor(red)) bin(2500) scheme(s1mono) ytitle("Interviews") xtitle("Date")

*****************************************************************************
*CREATING TREATMENT
*****************************************************************************

drop if edate== .
generate fukushima = .
replace fukushima = 1 if (edate > 18697)
replace fukushima = 0 if (edate < 18697)
tab fukushima

*****************************************************************************
*Figure 4 replication
*****************************************************************************

revrs scnsenv
reg revscnsenv fukushima, robust
quietly reg revscnsenv fukushima, robust
estimates store A
quietly reg revscnsenv fukushima gndr agea i.hinctnta eduyrs brncntr, robust
estimates store B
coefplot(A*, label(bivariate)) (B*, label(with covariates)), drop(_cons gndr agea *hinctnta eduyrs brncntr) xline(0, lcolor(red)) scheme(s1mono) xscale(r(-0.36 0.10)) xlabel(-0.35 -0.3 -0.25 -0.20 -0.15 -0.10 -0.05 0 0.05 0.10) title("") coeflabels(fukushima = "Post-Fukushima")

*****************************************************************************
*Figure 5 replication
*****************************************************************************

teffects psmatch (revscnsenv) (fukushima gndr agea i.hinctnta eduyrs brncntr)
estimates store A
teffects psmatch (revscnsenv) (fukushima gndr agea i.hinctnta eduyrs brncntr), atet
estimates store B

*Note: install ebalance
*ssc install ebalance, all replace
ebalance fukushima gndr agea i.hinctnta eduyrs brncntr, targets(1)
foreach v in gndr agea hinctnta eduyrs brncntr {
	foreach m in gndr agea hinctnta eduyrs brncntr {
	gen `v'X`m'=`v'*`m'
	} 
}

svyset [pweight=_webal]
svy: reg revscnsenv fukushima
estimates store C


coefplot(A*, label(Propensity score matching, ATT)) (B*, label(Propensity score matching, ATE)) (C*, label(Entropy balanced sample)), drop(_cons gndr agea *.hinctnta eduyrs brncntr) xline(0, lcolor(red)) scheme(s1mono) xscale(r(-0.36 0.10)) xlabel(-0.35 -0.3 -0.25 -0.20 -0.15 -0.10 -0.05 0 0.05 0.10) title("") coeflabels(fukushima = "Post-Fukushima")

*****************************************************************************
*Figure 6 replication
*****************************************************************************

reg revscnsenv fukushima##c.eduyrs gndr agea i.hinctnta brncntr, robust
margins, dydx(eduyrs) at(fukushima=(0 1))
marginsplot, yline(0)
margins, dydx(fukushima) at(eduyrs=(0(1)36))
marginsplot, yline(0) scheme(s1mono)
marginsplot, recast(line) recastci(rarea) yline(0, lcolor(red)) scheme(s1mono)

*****************************************************************************
*Figure 7 replication
*****************************************************************************

*(all days)
quietly reg revscnsenv fukushima, robust
estimates store A

*(+- 60 days)
preserve
drop if edate >18757
drop if edate <18637
quietly reg revscnsenv fukushima, robust
estimates store B
restore

*(+- 30 days) 
preserve
drop if edate >18727
drop if edate <18667
quietly reg revscnsenv fukushima,robust
estimates store C
restore

*(+- 25 days) 
preserve
drop if edate >18722
drop if edate <18672
quietly reg revscnsenv fukushima, robust
estimates store D
restore

coefplot(A*, label(Full period, 160 days (N=2065))) (B*, label(Restricted to +-60 days (N=1700))) (C*, label(Restricted to +-30 days (N=1115))) (D*, label(Restricted to +-25 days (N=927))) , drop(_cons gndr agea *.hinctnta eduyrs brncntr *.region2) xline(0, lcolor(red)) scheme(s1mono) xscale(r(-0.305 0.10)) xlabel(-0.3 -0.25 -0.20 -0.15 -0.10 -0.05 0 0.05 0.10) title("") coeflabels(fukushima = "Post-Fukushima")

*****************************************************************************
*Figure 8 replication
*****************************************************************************

generate placebo_early = .
replace placebo_early = 1 if (edate > 18637)
replace placebo_early = 0 if (edate < 18637)
tab placebo_early
reg revscnsenv placebo_early gndr agea i.hinctnta eduyrs brncntr, robust
estimates store A
generate placebo_later = .
replace placebo_later = 1 if (edate > 18777)
replace placebo_later = 0 if (edate < 18777)
tab placebo_later
reg revscnsenv placebo_later gndr agea i.hinctnta eduyrs brncntr, robust
estimates store B

coefplot(A*, label("")) (B*, label("")), drop(_cons gndr agea *hinctnta eduyrs brncntr) xline(0, lcolor(red)) scheme(s1mono) xscale(r(-0.705 0.10)) xlabel(-0.7 -0.6 -0.5 -0.4 -0.3 -0.20 -0.10 0 0.10 0.20) title("") coeflabels(fukushima = "Placebo date early")

*****************************************************************************
*Figure 9 replication
*****************************************************************************

generate fukushima_zero = .
replace fukushima_zero = 1 if (edate > 18696)
replace fukushima_zero = 0 if (edate < 18697)
tab fukushima_zero
quietly reg revscnsenv fukushima_zero gndr agea i.hinctnta eduyrs brncntr, robust
estimates store A
generate fukushima_long = .
replace fukushima_long = 1 if (edate > 18700)
replace fukushima_long = 0 if (edate < 18697)
tab fukushima_long
quietly reg revscnsenv fukushima_long gndr agea i.hinctnta eduyrs brncntr, robust
estimates store B

coefplot(A*, label("")) (B*, label("")), drop(_cons gndr agea *hinctnta eduyrs brncntr) xline(0, lcolor(red)) scheme(s1mono) xscale(r(-0.36 0.10)) xlabel(-0.35 -0.3 -0.25 -0.20 -0.15 -0.10 -0.05 0 0.05 0.10) title("") coeflabels(fukushima = "Post-Fukushima")

*****************************************************************************
*Figure 10 replication
*****************************************************************************

*Trust in police
quietly reg trstplc fukushima gndr agea i.hinctnta eduyrs brncntr, robust
estimates store A
*Interpersonal trust
quietly reg ppltrst fukushima gndr agea i.hinctnta eduyrs brncntr, robust
estimates store B
*satisfaction with life
quietly reg stflife fukushima gndr agea i.hinctnta eduyrs brncntr, robust
estimates store C
*Signed petition
quietly reg sgnptit fukushima gndr agea i.hinctnta eduyrs brncntr, robust
*LGBT rights 
estimates store D
quietly reg freehms fukushima gndr agea i.hinctnta eduyrs brncntr, robust
estimates store E
*Non-democratic parties
quietly reg prtyban fukushima gndr agea i.hinctnta eduyrs brncntr, robust
estimates store F
*Voted last election
generate voted = .
replace voted = 1 if (vote == 1)
replace voted = 2 if (vote == 2)
quietly reg voted fukushima gndr agea i.hinctnta eduyrs brncntr, robust
estimates store G
*Sociable habit
quietly reg sclmeet fukushima gndr agea i.hinctnta eduyrs brncntr, robust
estimates store H
*Feeling safe
quietly reg aesfdrk fukushima gndr agea i.hinctnta eduyrs brncntr, robust
estimates store I
*Religiosity
quietly reg rlgdgr fukushima gndr agea i.hinctnta eduyrs brncntr, robust
estimates store J

coefplot(A*, label("Trust in police"))(B*, label("Interpersonal trust"))(C*, label("Satisfaction with life"))(D*, label("Signed petition"))(E*, label("LGBT rights"))(F*, label("Ban non-democratic parties"))(G*, label("Voted last election"))(H*, label("Sociable habit"))(I*, label("Feeling safe")) (J*, label("Religiosity")), drop(_cons gndr agea *hinctnta eduyrs brncntr) xline(0, lcolor(red)) scheme(s1mono) xscale(r(-0.53 0.53)) xlabel(-0.5 -0.4 -0.3 -0.2 -0.10 0 0.1 0.2 0.3 0.4 0.5) title("") coeflabels(fukushima = "Post-Fukushima")

*****************************************************************************
*TABLE A1 replication
*****************************************************************************

sort fukushima
drop if fukushima== . 
by fukushima: summarize gndr agea hinctnta eduyrs brncntr

*****************************************************************************
*TABLE A2 replication
*****************************************************************************

*Model A2a
reg revscnsenv fukushima, robust
*Model A2b
reg revscnsenv fukushima gndr agea i.hinctnta eduyrs brncntr, robust
*Model A2c
reg revscnsenv fukushima##c.eduyrs gndr agea i.hinctnta brncntr, robust
*Model A2d
ologit revscnsenv fukushima gndr agea i.hinctnta eduyrs brncntr, robust


*****************************************************************************
*TABLE A3 replication
*****************************************************************************

clear
*open the data file (3) "ESS_R5_Israel_FE.dta"

drop if edate== .
generate fukushima = .
replace fukushima = 1 if (edate > 18697)
replace fukushima = 0 if (edate < 18697)
tab fukushima
*Model A3a
reg revscnsenv fukushima i.region_IL, robust
*Model A3b
reg revscnsenv fukushima gndr agea i.hinctnta eduyrs brncntr i.region_IL, robust
*Model A3c
reg revscnsenv fukushima##c.eduyrs gndr agea i.hinctnta brncntr i.region_IL, robust
*Model A2c
ologit revscnsenv fukushima gndr agea i.hinctnta eduyrs brncntr, robust

*****************************************************************************
*TABLE A4 replication
*****************************************************************************

clear
*open the data file (2) "ESS_R5_Israel.dta"

drop if edate== .
generate fukushima = .
replace fukushima = 1 if (edate > 18697)
replace fukushima = 0 if (edate < 18697)
tab fukushima
revrs scnsenv

*Model A4a
teffects psmatch (revscnsenv) (fukushima gndr agea i.hinctnta eduyrs brncntr)
*Model A4b
teffects psmatch (revscnsenv) (fukushima gndr agea i.hinctnta eduyrs brncntr), atet
*Model A4c
ebalance fukushima gndr agea i.hinctnta eduyrs brncntr, targets(1)
foreach v in gndr agea hinctnta eduyrs brncntr {
	foreach m in gndr agea hinctnta eduyrs brncntr {
	gen `v'X`m'=`v'*`m'
	} 
}
svyset [pweight=_webal]
svy: reg revscnsenv fukushima

*****************************************************************************
*Figure A1 replication
*****************************************************************************

preserve
drop if eduyrs>20
quietly reg revscnsenv fukushima##c.eduyrs gndr agea i.hinctnta brncntr, robust
margins, dydx(fukushima) at(eduyrs=(0(1)20))
marginsplot, yline(0) scheme(s1mono)
marginsplot, recast(line) recastci(rarea) yline(0, lcolor(red)) scheme(s1mono)
restore

*****************************************************************************
*Table A5 replication
*****************************************************************************

*Model A5a
reg revscnsenv fukushima, robust
estimates store A
*Model A5b
preserve
drop if edate >18757
drop if edate <18637
reg revscnsenv fukushima, robust
estimates store B
restore
*Model A5c
preserve
drop if edate >18727
drop if edate <18667
reg revscnsenv fukushima,robust
estimates store C
restore
*Model A5d
preserve
drop if edate >18722
drop if edate <18672
reg revscnsenv fukushima, robust
estimates store D
restore

*****************************************************************************
*Table A6 replication
*****************************************************************************

*Model A6a
generate placebo_early = .
replace placebo_early = 1 if (edate > 18637)
replace placebo_early = 0 if (edate < 18637)
tab placebo_early
reg revscnsenv placebo_early gndr agea i.hinctnta eduyrs brncntr, robust

*Model A6b
generate placebo_later = .
replace placebo_later = 1 if (edate > 18777)
replace placebo_later = 0 if (edate < 18777)
tab placebo_later
reg revscnsenv placebo_later gndr agea i.hinctnta eduyrs brncntr, robust

*Model A6c
generate fukushima_zero = .
replace fukushima_zero = 1 if (edate > 18696)
replace fukushima_zero = 0 if (edate < 18697)
tab fukushima_zero
reg revscnsenv fukushima_zero gndr agea i.hinctnta eduyrs brncntr, robust

*Model A6d
generate fukushima_long = .
replace fukushima_long = 1 if (edate > 18700)
replace fukushima_long = 0 if (edate < 18697)
tab fukushima_long
reg revscnsenv fukushima_long gndr agea i.hinctnta eduyrs brncntr, robust

*****************************************************************************
*Table A7 replication
*****************************************************************************

*Model A7a
reg trstplc fukushima gndr agea i.hinctnta eduyrs brncntr, robust
*Model A7b
reg ppltrst fukushima gndr agea i.hinctnta eduyrs brncntr, robust
*Model A7c
reg stflife fukushima gndr agea i.hinctnta eduyrs brncntr, robust
*Model A7d
reg sgnptit fukushima gndr agea i.hinctnta eduyrs brncntr, robust
*Model A7e
reg freehms fukushima gndr agea i.hinctnta eduyrs brncntr, robust
*Model A7f
reg prtyban fukushima gndr agea i.hinctnta eduyrs brncntr, robust
*Model A7g
generate voted = .
replace voted = 1 if (vote == 1)
replace voted = 2 if (vote == 2)
reg voted fukushima gndr agea i.hinctnta eduyrs brncntr, robust
*Model A7h
reg sclmeet fukushima gndr agea i.hinctnta eduyrs brncntr, robust
*Model A7i
reg aesfdrk fukushima gndr agea i.hinctnta eduyrs brncntr, robust
*Model A7j
reg rlgdgr fukushima gndr agea i.hinctnta eduyrs brncntr, robust

*****************************************************************************
*Table A8 replication
*****************************************************************************

*Model A8a
reg revscnsenv fukushima##c.tvtot gndr agea i.hinctnta eduyrs brncntr, robust
*Model A8b
reg revscnsenv fukushima##c.tvpol gndr agea i.hinctnta eduyrs brncntr, robust
*Model A8c
reg revscnsenv fukushima##c.nwsptot gndr agea i.hinctnta eduyrs brncntr, robust
*Model A8d
reg revscnsenv fukushima##c.nwsppol gndr agea i.hinctnta eduyrs brncntr, robust

*****************************************************************************
*Table A9 replication
*****************************************************************************

*Model A9a
generate likud = .
replace likud = 1 if (prtvtbil==2)
replace likud = 0 if (prtvtbil==1)
replace likud = 0 if (prtvtbil==3)
replace likud = 0 if (prtvtbil==4)
replace likud = 0 if (prtvtbil==5)
replace likud = 0 if (prtvtbil==6)
replace likud = 0 if (prtvtbil==7)
replace likud = 0 if (prtvtbil==8)
replace likud = 0 if (prtvtbil==9)
replace likud = 0 if (prtvtbil==10)
replace likud = 0 if (prtvtbil==11)
replace likud = 0 if (prtvtbil==12)
replace likud = 0 if (prtvtbil==13)
replace likud = 0 if (prtvtbil==14)
replace likud = 0 if (prtvtbil==15)
replace likud = 0 if (prtvtbil==16)
tab likud
reg revscnsenv fukushima##i.likud gndr agea i.hinctnta eduyrs brncntr, robust

*Model A9b
generate coalition = .
replace coalition = 1 if (prtvtbil==2)
replace coalition = 1 if (prtvtbil==1)
replace coalition = 0 if (prtvtbil==3)
replace coalition = 1 if (prtvtbil==4)
replace coalition = 0 if (prtvtbil==5)
replace coalition = 1 if (prtvtbil==6)
replace coalition = 1 if (prtvtbil==7)
replace coalition = 0 if (prtvtbil==8)
replace coalition = 0 if (prtvtbil==9)
replace coalition = 0 if (prtvtbil==10)
replace coalition = 0 if (prtvtbil==11)
replace coalition = 0 if (prtvtbil==12)
replace coalition = 0 if (prtvtbil==13)
replace coalition = 0 if (prtvtbil==14)
replace coalition = 0 if (prtvtbil==15)
replace coalition = 0 if (prtvtbil==16)
tab coalition
reg revscnsenv fukushima##i.coalition gndr agea i.hinctnta eduyrs brncntr, robust



*******************************************************************************
*REPLICATION OF US EXPERIMENT
*******************************************************************************

clear
*Open (4) "Experiment_US.dta"

*****************************************************************************
*Table B2 replication
*****************************************************************************

sum age
sum man
sum edu
sum immigrant

*****************************************************************************
*Table B3 replication
*****************************************************************************

preserve
keep if treatment==0
sum age
sum man
sum edu
sum immigrant
restore

preserve
keep if treatment==1
sum age
sum man
sum edu
sum immigrant
restore

*****************************************************************************
*T-test mentioned in text, p. 27
*****************************************************************************

preserve
keep if treatment==1
sum Q18
restore
preserve
keep if treatment==0
sum Q18
restore
ttest Q18, by(treatment)

*****************************************************************************
*Figure B2 replication
*****************************************************************************

reg Q18 treatment, robust
estimates store A
reg Q18 treatment man immigrant age edu, robust
estimates store B
teffects ra (Q18) (treatment)
estimates store C
coefplot(A*, label("OLS"))(B*, label("OLS, covariates"))(C*, label("ATE")), drop(_cons man age edu immigrant) xline(0, lcolor(red)) scheme(s1mono) xscale(r(-0.5 0.10)) xlabel(-0.5 -0.4 -0.3 -0.20 -0.10 0 0.10) title("") coeflabels(treatment = "Treatment")

*****************************************************************************
*Figure B3 replication
*****************************************************************************

reg Q18 treatment##c.edu man immigrant age edu, robust
margins, dydx(treatment) at(edu=(0(1)25))
marginsplot, yline(0) scheme(s1mono)
marginsplot, recast(line) recastci(rarea) yline(0, lcolor(red)) scheme(s1mono)

*****************************************************************************
*Table B4 replication
*****************************************************************************

*Model B4a
reg Q18 treatment, robust
*Model B4b
reg Q18 treatment man immigrant age edu, robust
*Model B4c
teffects ra (Q18) (treatment)





*******************************************************************************
*REPLICATION OF ISRAEL EXPERIMENT
*******************************************************************************

clear
*Open (5) "Experiment_IL.dta"

*****************************************************************************
*Table B5 replication
*****************************************************************************

sum age
sum man
sum edu
sum immigrant

*****************************************************************************
*Table B6 replication
*****************************************************************************

preserve
keep if treatment==0
sum age
sum man
sum edu
sum immigrant
restore

preserve
keep if treatment==1
sum age
sum man
sum edu
sum immigrant
restore

*****************************************************************************
*Figure B4 replication
*****************************************************************************

reg Q18 treatment, robust
estimates store A
reg Q18 treatment man immigrant age edu, robust
estimates store B
teffects ra (Q18) (treatment)
estimates store C
coefplot(A*, label("OLS"))(B*, label("OLS, covariates"))(C*, label("ATE")), drop(_cons man age edu immigrant) xline(0, lcolor(red)) scheme(s1mono) xscale(r(-0.5 0.10)) xlabel(-0.5 -0.4 -0.3 -0.20 -0.10 0 0.10) title("") coeflabels(treatment = "Treatment")

*****************************************************************************
*T-test mentioned in text, p. 29-30
*****************************************************************************

preserve
keep if treatment==1
sum Q18
restore
preserve
keep if treatment==0
sum Q18
restore
ttest Q18, by(treatment)

*****************************************************************************
*Table B7 replication
*****************************************************************************

*Model B7a
reg Q18 treatment, robust
*Model B7b
reg Q18 treatment man immigrant age edu, robust
*Model B7c
teffects ra (Q18) (treatment)

*****************************************************************************
*Figure B5 replication
*****************************************************************************

reg Q18 treatment##c.edu man immigrant age edu, robust
margins, dydx(treatment) at(edu=(0(1)25))
marginsplot, yline(0) scheme(s1mono)
marginsplot, recast(line) recastci(rarea) yline(0, lcolor(red)) scheme(s1mono)


*THE END
